﻿using IBLL;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Model;

namespace WebAPI.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class MemberController : ControllerBase
    {
        public MemberController(IMemberBLL bLL,ILogger<Member> logger)
        {
            BLL = bLL;
            Logger = logger;
        }

        public IMemberBLL BLL { get; }
        public ILogger<Member> Logger { get; }


        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="m">参数</param>
        /// <returns>可影响行数</returns>
        [HttpPost]
        public Task<int> MAdd(Member m)
        {
            try
            {
                Logger.LogInformation("添加了一条数据");
                return BLL.MAdd(m);
            }
            catch (Exception)
            {


                throw;
            }
           
        }
        /// <summary>
        /// 显示
        /// </summary>
        /// <param name="HId">所属门店下拉框</param>
        /// <param name="Num">下单次数次数</param>
        /// <param name="MDate">会员时间</param>
        /// <returns>可影响行数</returns>
        [HttpGet]
        public dynamic MShow(int HId, int Num, DateTime? MDate)
        {
            return BLL.MShow(HId, Num, MDate);
        }
        /// <summary>
        /// 下拉框
        /// </summary>
        /// <returns>可影响行数</returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpGet]
        public List<House> Xia()
        {
            return BLL.Xia();
        }


    }
}
